#include <xpp/bas/Queue.h>
#include <xp/bas/stdio.h>

#ifdef __linux
#include <mcheck.h>
#endif

using namespace xpp::bas;

#ifdef __cplusplus
extern "C" { int xp_main (int argc, xp_char_t* argv[], xp_char_t** envp); }
#endif

int xp_main (int argc, xp_char_t* argv[], xp_char_t** envp)
{

#ifdef __linux
	mtrace ();
#endif

	{
		Queue<int> x;
		//Queue<int> x (100);

		x.push (9);
		x.push (8);
		x.push (7);
		x.push (6);

		while (x.size() > 0) {
			xp_printf (XP_TEXT("%d\n"), x.front());
			x.pop ();
		}

		x.push (10);
		x.push (7);
		x.pop ();
		x.push (6);
		x.push (5);
		x.push (4);
		x.pop ();
		x.pop ();
		x.push (3);

		xp_printf (XP_TEXT("-------------\n"));
		while (x.size() > 0) {
			xp_printf (XP_TEXT("%d\n"), x.front());
			x.pop ();
		}
	}

#ifdef __linux
	muntrace ();
#endif
	return 0;
}
